#include <Inklude/ikCarchiver.h>
#include <zlib/zlib.h>
#include <ext/quicklz.h>

using namespace Inklude;
void ikCarchiver::CompressZlib(void* pSource, unsigned int nSourceSize, void* pDest, unsigned int& nDestSize)
{
    compress2((Bytef*)pDest, (unsigned long*)(&nDestSize), (Bytef*)pSource, (unsigned long)nSourceSize, Z_BEST_SPEED);
}

void ikCarchiver::DecompressZlib(void* pSource, unsigned int nSourceSize, void* pDest, unsigned int& nDestSize)
{
    uncompress((Bytef*)pDest, (unsigned long*)(&nDestSize), (Bytef*)pSource, (unsigned long)nSourceSize);
}


void ikCarchiver::CompressQpress(void* pSource, unsigned int nSourceSize, void* pDest, unsigned int& nDestSize)
{
    qlz_state_compress qlzState;
    nDestSize = qlz_compress(pSource, (char*)pDest, nSourceSize, &qlzState);
}

void ikCarchiver::DecompressQpress(void* pSource, unsigned int nSourceSize, void* pDest, unsigned int& nDestSize)
{
    qlz_state_decompress qlzState;
    nDestSize = qlz_decompress((const char*)pSource, pDest, &qlzState);
}

